package com.lonty.intelligence.controller;

import com.lonty.intelligence.api.Result;
import com.lonty.intelligence.api.ResultCode;
import com.lonty.intelligence.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @Author 陈璇
 * @Date 2020/4/16 11:48
 * @Version 1.0
 **/
@RestController
@RequestMapping("app/role")
@Validated
@Api(tags = "权限接口", produces = "application/json")
public class RoleController {

    @Resource
    private RoleService roleService;

    @ApiOperation(value = "保存权限", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "grade", value = "等级",dataType = "int", paramType = "query", required = true)
    })
    @PostMapping("saveRole")
    public Result saveRole(Integer grade){
        if(roleService.saveRole(grade)){
            return Result.builder().build();
        }
        return Result.builder(ResultCode.OPERATION_ERROR).build();
    }

}
